package xdu.lz.stage2_design_pattern.chapter6_immutable_pattern.immutable_pattern;

//不可变数据，不可被继承重写，final修饰
public final class Person {
    //不可变共享数据，不提供set方法
    private final String name;
    private final String address;

    public Person(String name, String address) {
        this.name = name;
        this.address = address;
    }

    public String getName() {
        return name;
    }

    public String getAddress() {
        return address;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", address='" + address + '\'' +
                '}';
    }
}
